package cn.donting.jme.editor.file;

import lombok.Data;

import java.util.Objects;

@Data
public class FileMeta {
    private String filePath;
    private long length;
    private long lastModifyTime;
    private int hash;


    public boolean isRename(FileMeta fileMeta) {
        return length == fileMeta.length && lastModifyTime == fileMeta.lastModifyTime && hash == fileMeta.hash;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FileMeta fileMeta = (FileMeta) o;
        return length == fileMeta.length && lastModifyTime == fileMeta.lastModifyTime && hash == fileMeta.hash && Objects.equals(filePath, fileMeta.filePath);
    }

    @Override
    public int hashCode() {
        return Objects.hash(filePath, length, lastModifyTime, hash);
    }
}
